# Colab Tiips
# !cat /etc/issue # os info
# !free -h # memory info
# !cat /proc/cpuinfo # cpu info
# !mkdir test # make directory
# !ls 'sample_data/' # list files
# %cd test # change directory
# !echo 'test' > test.txt # create file
# !mv test.txt '/content/drive/My Drive' # move file
# !pip install tensorflow==1.8.0 # install library
# Import Library
import os
import numpy as np
import pandas as pd
from datetime import datetime
import warnings
warnings.filterwarnings("ignore")
# Get Package Version
import platform
print("python " + platform.python_version())
import tensorflow as tf
print("tensorflow " + tf.__version__)
# List file
% ls sample_data/
# Upload file from local
from google.colab import files
uploaded = files.upload()
# Upload file from kaggle
import os
os.environ['KAGGLE_USERNAME'] = "jingwora1" # username from the json file
os.environ['KAGGLE_KEY'] = "92dbfea6346fc608e08b8b31383520d2" # key from the json file
!kaggle datasets download -d rush4ratio/video-game-sales-with-ratings # api copied from kaggle
#zipファイルを開放して削除する
!unzip \*.zip && rm *.zip
# Upload file from wikimedia
import urllib
img_src = "https://upload.wikimedia.org/wikipedia/commons/thumb/2/21/64_365_Color_Macro_%285498808099%29.jpg/320px-64_365_Color_Macro_%285498808099%29.jpg"
img_path = 'input_image.jpg'
urllib.request.urlretrieve(img_src, img_path)
# Show image
from IPython.display import Image,display_jpeg
img_path = 'input_image.jpg'
display_jpeg(Image(img_path))
# Create folder
output_dir = ('output/')
if not os.path.exists(output_dir):
os.makedirs(output_dir)
# Download file
from google.colab import files
output_path = 'sample_data/california_housing_train.csv'
files.download(output_path)
# Mount with g-drive
from google.colab import drive
drive.mount('/content/drive')
! ls 'drive/My Drive/dataset/time/'
# Show files
Timing
import time
start_time = time.time()
print('Duration: {:.4f} seconds'. format(time.time() - start_time))